home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 76 / XENIATGM66.iso / Indiana Jones / Indiana Jones.exe / RESOURCE / PREVIEW.GOB / cog_tem_tiki2door.cog < prev    next >
Text File  |  1999-11-15  |  9KB  |  364 lines

  1. # Jones 3D Cog Script
  2. #
  3. # TEM_Tiki2Door.cog
  4. #
  5. # monkeykey = 54
  6. #
  7. # [TRM]
  8. #
  9. # (C) 1999 LucasArts Entertainment Co. All Rights Reserved
  10. # ========================================================================================
  11.  
  12. symbols
  13.         
  14.     message     startup
  15.     message     entered
  16.     message     exited
  17.     message     activate
  18.     
  19.     thing       player          local
  20.     thing       door0
  21.     thing       door1
  22.     thing       ghostcampos
  23.     thing       lSpotOffset
  24.     thing       rSpotOffset
  25.     thing       insideOffset
  26.     thing       indy
  27.     
  28.     sector      doorSec
  29.     sector      close
  30.     
  31.     surface     surf_LSpot
  32.     surface     surf_RSpot
  33.     
  34.     # ** using the wrong or no item lines (whichLine = 1) **
  35.     sound        in_WrongLine0=Inxj089.wav       local # That didn't work
  36.     sound        in_WrongLine1=Inxj090.wav        local # ...something wrong.
  37.     sound        in_WrongLine2=Inxj092.wav        local # Hmm...didn't quite work.
  38.     sound        in_WrongLine3=Inxj060.wav        local # I don't think...right answer
  39.     sound        in_WrongLine4=Inxj087.wav        local # Whoops.
  40.     sound        in_WrongLine5=Inxj088.wav        local # Nope.
  41.     sound        in_WrongLine6=Inxj091.wav        local # Of course that didn't work.
  42.     
  43.     # ** locked door lines (whichLine = 2) **
  44.     sound        in_DoorLocked0=Inxj081.wav        local # Oh no...why...always locked?
  45.     sound       in_DoorLocked1=Inxj076.wav      local # This door is locked
  46.     sound       in_DoorLocked2=Inxj077.wav      local # it's locked
  47.     sound        in_DoorLocked3=Inxj077.wav        local # It's locked.
  48.     sound        in_DoorLocked4=Inxj078.wav        local # Locked.
  49.     sound        in_DoorLocked5=Inxj082.wav        local # keyhole here...just need key.
  50.     sound        in_DoorLocked6=Inxj080.wav        local # Locked...luck never changes.
  51.     
  52.     # ** success key lines (whichLine = 3) **
  53.     sound        in_Success0=Inxj103.wav            local # Whoa! It opened.
  54.     sound        in_Success1=Inxj111.wav            local # what...know...worked!
  55.     sound        in_Success2=Inxj106.wav            local # ...got lucky.
  56.     sound        in_Success3=Inxj105.wav            local # ...be damned...opened.
  57.     
  58.     # ** just won't open lines (whichLine = 4) **
  59.     sound        in_WontOpen0=Inxj096.wav        local # I can't open it
  60.     sound        in_WontOpen1=Inxj097.wav        local # For some reason...won't open.
  61.     sound        in_WontOpen2=Inxj098.wav        local # It won't budge.
  62.     sound        in_WontOpen3=Inxj099.wav        local # Something is holding this door closed.
  63.     sound        in_WontOpen4=Inxj102.wav        local # must be way...don't know how.
  64.  
  65.     sound       sndUnlock=tem_monkeykey_unlock_c.wav        local
  66.     sound       inAgain=Inxj096.wav                         local   # I can't open it.
  67.     
  68.     # ** music **
  69.     sound       mus_AweInspiring=mus_tem_tiki2int.wav   local
  70.     
  71.     cog         ambTiki2
  72.     cog         cog_Hint
  73.     
  74.     # ** subroutines **
  75.     flex        openDoor        local
  76.     flex        noWayOut        local
  77.     flex        speak           local
  78.         
  79.     int         open=0          local
  80.     int         closed=0        local
  81.     int         playing=0       local
  82.     int         firstTime=0     local
  83.     int         whichLine=0     local
  84.     int         curCam          local
  85.     int         curItem         local
  86.     int         newComment      local
  87.     int         oldComment      local
  88.     int         lSpot=0         local
  89.     int         rSpot=0         local
  90.     int         firstVisit=0    local
  91.     
  92. end
  93.  
  94. # ========================================================================================
  95.  
  96. code
  97.     
  98. startup:
  99.  
  100.     player = GetLocalPlayerThing();
  101.     SectorAdjoins(doorSec, 0);
  102.     return;
  103.  
  104. # ========================================================================================
  105.   
  106. entered:
  107.  
  108.     if(GetSenderRef() == surf_LSpot)
  109.     {
  110.         lSpot = 1;
  111.     }
  112.     
  113.     else if(GetSenderRef() == surf_RSpot)
  114.     {
  115.         rSpot = 1;
  116.     }
  117.     
  118.     # close the door when player enters room
  119.     else if((GetSenderRef() == close) && (closed == 0))
  120.     {
  121.         closed = 1;
  122.         #SetFog(0, '0.20, 0.20, 0.20', 30, 100);
  123.         
  124.         Rotate(door0, -90, 1, 5.0);
  125.         Rotate(door1, 90, 1, 5.0);
  126.         WaitForStop(door1);
  127.         SectorAdjoins(doorSec, 0);
  128.     }
  129.         
  130.     return;
  131.  
  132. # ========================================================================================
  133.  
  134. exited:
  135.  
  136.     if(GetSourceRef() == player)
  137.     {
  138.         if(GetSenderRef() == surf_LSpot)
  139.         {
  140.             lSpot = 0;
  141.         }
  142.         
  143.         else if(GetSenderRef() == surf_RSpot)
  144.         {
  145.             rSpot = 0;
  146.         }
  147.     }
  148.         
  149.     return;
  150.     
  151. # ========================================================================================
  152.  
  153. activate:
  154.  
  155.     player = GetLocalPlayerThing();
  156.     curCam = GetCurrentCamera();
  157.     curItem = GetCurItem(player);
  158.     
  159.     if((GetSenderRef() == door0) || (GetSenderRef() == door1))
  160.     {  
  161.         if((open == 0) && (playing == 0))
  162.         {
  163.             if(curItem == 54)
  164.             {
  165.                 open = 1;
  166.                 Call openDoor;
  167.             }
  168.             
  169.             # player doesn't have or is not using the key
  170.             else if(curItem == 0)
  171.             {
  172.                 playing = 1;
  173.                 whichLine = 2;
  174.                 Call speak;
  175.                 whichLine = 0;
  176.             }
  177.             
  178.             else
  179.             {
  180.                 playing = 1;
  181.                 whichLine = 1;
  182.                 Call speak;
  183.                 whichLine = 0;
  184.             }
  185.         }
  186.         
  187.         # player can't get back out of room
  188.         else if((closed == 1) && (playing == 0))
  189.         {
  190.             playing = 1;
  191.             Call noWayOut;
  192.         }
  193.     }
  194.         
  195.     return;
  196.         
  197. # ========================================================================================
  198.  
  199. openDoor:
  200.  
  201.     # solve hint31
  202.     SendMessage(cog_Hint, user0);
  203.     
  204.     # do cutscene stuff
  205.     MakeMeStop();
  206.     StartCutscene(2);
  207.     
  208.     DeselectWeaponWait(player);
  209.     
  210.     # activate door
  211.     PlayMode(player, 60, 0);
  212.     Sleep(0.3);
  213.     
  214.     # remove key from inventory
  215.     ChangeInv(player, 54, -1);
  216.     
  217.     # play unlock sound
  218.     PlaySoundLocal(sndUnlock, 1.0, 0.0, 0x0, 1);
  219.     
  220.     # clear door adjoin
  221.     SectorAdjoins(doorSec, 1);
  222.     
  223.     # open doors
  224.     Rotate(door0, 90, 1, 5.0);
  225.     Rotate(door1, -90, 1, 5.0);
  226.  
  227.     # switch to external camera
  228.     SetCameraFocus(2, ghostcampos);
  229.     SetCameraSecondaryFocus(2, indy);
  230.     SetCurrentCamera(2);
  231.     
  232.     # hide player show indy
  233.     SetThingFlags(player, 0x80000);
  234.     ClearThingFlags(indy, 0x80000);
  235.     
  236.     # move camera in as doors open
  237.     MoveToFrame(ghostcampos, 1, 0.9);
  238.     WaitForStop(door1);
  239.     
  240.     Sleep(0.5);
  241.     
  242.     # say success line
  243.     PlayVoice(indy, in_Success0[RandBetween(0, 3)], 1.0, 1);
  244.     
  245.     Sleep(0.5);
  246.     
  247.     CopyOrientAndPos(indy, player);
  248.     
  249.     # hide actor show player
  250.     SetThingFlags(indy, 0x80000);
  251.     ClearThingFlags(player, 0x80000);
  252.     
  253.     # restore camera
  254.     SetCurrentCamera(curCam);
  255.     
  256.     # play music cue after camera is returned to player????
  257.     PlaySoundLocal(mus_AweInspiring, 1.0, 0.0, 0x0, 0);
  258.     
  259.     # restore controls
  260.     ClearActorFlags(player, 0x200000);
  261.     EndCutscene();
  262.     
  263.     # turn on tiki2 room ambients
  264.     SendMessage(ambTiki2, user0);
  265.     
  266.     return;
  267.     
  268. # ========================================================================================
  269.  
  270. noWayOut:
  271.  
  272.     # do cutscene stuff
  273.     MakeMeStop();
  274.     StartCutscene(2);
  275.     
  276.     # offset camera
  277.     SetExtCamOffsetToThing(insideOffset);
  278.     
  279.     DeselectWeaponWait(player);
  280.     
  281.     # nudge door
  282.     PlayMode(player, 60, 0);
  283.     Sleep(0.3);
  284.     
  285.     # play voice line
  286.     PlayVoice(player, in_WontOpen0[RandBetween(0, 4)], 1.0, 1);
  287.     
  288.     Sleep(0.5);
  289.     
  290.     # restore camera
  291.     RestoreExtCam();
  292.     
  293.     # restore controls
  294.     ClearActorFlags(player, 0x200000);
  295.     EndCutscene();
  296.     
  297.     playing = 0;
  298.     
  299.     return;
  300.     
  301. # ========================================================================================
  302.  
  303. speak:
  304.  
  305.     while (newComment == oldComment) 
  306.     {
  307.         newComment = RandBetween(0, 2);
  308.     }
  309.     
  310.     if(firstVisit == 0)
  311.     {
  312.         firstVisit = 1;
  313.     }
  314.     
  315.     oldComment = newComment;
  316.     
  317.     # do cutscene stuff
  318.     MakeMeStop();
  319.     StartCutscene(0);
  320.     
  321.     # switch to interpCam
  322.     if(lSpot == 1) SetExtCamOffsetToThing(lSpotOffset);
  323.     
  324.     else if(rSpot == 1) SetExtCamOffsetToThing(rSpotOffset);
  325.     
  326.     DeselectWeaponWait(player);
  327.     
  328.     # nudge the door
  329.     PlayMode(player, 60, 0);
  330.     Sleep(0.3);
  331.     
  332.     if(whichLine == 1)
  333.     {
  334.         # using the wrong item
  335.         PlayVoice(player, in_WrongLine0[newComment], 1.0, 1);
  336.     }
  337.     
  338.     else if(whichLine == 2)
  339.     {
  340.         # locked door lines
  341.         PlayVoice(player, in_DoorLocked0[newComment], 1.0, 1);
  342.     }
  343.     
  344.     else if(whichLine == 3)
  345.     {
  346.         # door is open
  347.         PlayVoice(player, in_Success0[newComment], 1.0, 1);
  348.     }
  349.     
  350.     # restore controls and camera
  351.     ClearActorFlags(player, 0x200000);
  352.     RestoreExtCam();
  353.     
  354.     EndCutscene();
  355.     
  356.     playing = 0;
  357.     
  358.     return;
  359.     
  360. # ========================================================================================
  361.       
  362. end
  363.  
  364.